home *** CD-ROM | disk | FTP | other *** search
- {{{ comments
- ; Jump from [,{ or ( to a matching ],} or ).
- ; if no match can be found, a errormessage appears.
- }}}
- nodup
- {{{ libs
- {{{F pre-char.fun
- :::F pre-char.fun
- }}}
- {{{F error.fun
- :::F error.fun
- }}}
- }}}
- {{{ goto-matching-fence
- {{{ next_char op
- (deffun next_char (
- O_RIGHT
- if test-end-line (
- {{{ next textline
- do (
- O_DOWN
- if test-fold-line (
- O_OPEN_FOLD
- ) else (
- if test-end-fold (O_CLOSE_FOLD) fi
- ) fi
- )
- while and(not(test-bottom),not(test-text))
- O_START_OF_LINE
- }}}
- ) fi
- ))
- }}}
- (deffun goto-matching-fence (
- if not(test-text) (oops) fi
- store-line matching-fence-y
- store-pos matching-fence-x
- case
- {{{ {
- (test-char "{ (
- set-counter fence-counter 1
- do (
- {{{ check one character
- next_char
- if test-char "{ (
- add-counter fence-counter 1
- ) else (
- if test-char "} (add-counter fence-counter -1) fi
- ) fi
- }}}
- ) while and(not(test-bottom),not(counter-0 fence-counter))
- {{{ not found ?
- if test-bottom (
- goto-line-counter matching-fence-y
- goto-counter matching-fence-x
- failed
- ) fi
- }}}
- ))
- }}}
- {{{ }
- (test-char "} (
- set-counter fence-counter 1
- do (
- {{{ check one character
- previous-text-character
- if test-char "} (
- add-counter fence-counter 1
- ) else (
- if test-char "{ (add-counter fence-counter -1) fi
- ) fi
- }}}
- ) while and(not(counter-0 fence-counter),not(test-top))
- {{{ not found ?
- if test-top (
- goto-line-counter matching-fence-y
- goto-counter matching-fence-x
- failed
- ) fi
- }}}
- ))
- }}}
- {{{ [
- (test-char "[ (
- set-counter fence-counter 1
- do (
- {{{ check one character
- next_char
- if test-char "[ (
- add-counter fence-counter 1
- ) else (
- if test-char "] (add-counter fence-counter -1) fi
- ) fi
- }}}
- ) while and(not(test-bottom),not(counter-0 fence-counter))
- {{{ not found ?
- if test-bottom (
- goto-line-counter matching-fence-y
- goto-counter matching-fence-x
- failed
- ) fi
- }}}
- ))
- }}}
- {{{ ]
- (test-char "] (
- set-counter fence-counter 1
- do (
- {{{ check one character
- previous-text-character
- if test-char "] (
- add-counter fence-counter 1
- ) else (
- if test-char "[ (add-counter fence-counter -1) fi
- ) fi
- }}}
- ) while and(not(counter-0 fence-counter),not(test-top))
- {{{ not found ?
- if test-top (
- goto-line-counter matching-fence-y
- goto-counter matching-fence-x
- failed
- ) fi
- }}}
- ))
- }}}
- {{{ (
- (test-char "( (
- set-counter fence-counter 1
- do (
- {{{ check one character
- next_char
- if test-char "( (
- add-counter fence-counter 1
- ) else (
- if test-char ") (add-counter fence-counter -1) fi
- ) fi
- }}}
- ) while and(not(test-bottom),not(counter-0 fence-counter))
- {{{ not found ?
- if test-bottom (
- goto-line-counter matching-fence-y
- goto-counter matching-fence-x
- failed
- ) fi
- }}}
- ))
- }}}
- {{{ )
- (test-char ") (
- set-counter fence-counter 1
- do (
- {{{ check one character
- previous-text-character
- if test-char ") (
- add-counter fence-counter 1
- ) else (
- if test-char "( (add-counter fence-counter -1) fi
- ) fi
- }}}
- ) while and(not(counter-0 fence-counter),not(test-top))
- {{{ not found ?
- if test-top (
- goto-line-counter matching-fence-y
- goto-counter matching-fence-x
- failed
- ) fi
- }}}
- ))
- }}}
- esac
- ))
- }}}
-